﻿Partial Public Class ApptSchedulerControl

    Private Sub MyOnAppointmentlLoadMapping(ByVal sender As Object, ByVal e As EventArgs)
        SchedulerStorage1.Appointments.Mappings.AppointmentId = "Id"
        SchedulerStorage1.Appointments.Mappings.AllDay = "AllDayEvent"
        SchedulerStorage1.Appointments.Mappings.Description = "Body"
        SchedulerStorage1.Appointments.Mappings.Label = "Labelint"
        SchedulerStorage1.Appointments.Mappings.Subject = "Subject"
        SchedulerStorage1.Appointments.Mappings.Location = "Location"
        SchedulerStorage1.Appointments.Mappings.Start = "Start"
        SchedulerStorage1.Appointments.Mappings.End = "End"
        '  Me.SchedulerStorage1.Appointments.Mappings.Status = "Status"
        ' Me.SchedulerStorage1.Appointments.Mappings.Type = "Type"

        Me.SchedulerStorage1.Appointments.CustomFieldMappings.Add(New AppointmentCustomFieldMapping("CustomGroupId", "GroupId_FK"))
        Me.SchedulerStorage1.Appointments.CustomFieldMappings.Add(New AppointmentCustomFieldMapping("CustomClassId", "ClassId_FK"))
        Me.SchedulerStorage1.Appointments.CustomFieldMappings.Add(New AppointmentCustomFieldMapping("CustomCategoryId", "CategoryId_FK"))
        Me.SchedulerStorage1.Appointments.CustomFieldMappings.Add(New AppointmentCustomFieldMapping("CustomTypeId", "TypeId_FK"))

    End Sub

    Private Sub MyOnLabelLoadMapping(ByVal sender As Object, ByVal e As EventArgs)
        Dim labelColor As LabelColor

        If Not String.IsNullOrWhiteSpace(LabelQueryName) Then
            LabelQuery = MetaQuery.GetMetaQueryByName(LabelQueryName)
            LabelQuery.FillResultQuery()
            For Each row As DataRow In LabelQuery.ResultQuery.Rows
                Me.SchedulerStorage1.Appointments.Labels.Add(SetColor(row("color")), row("MenuCaption").ToString, row("MenuCaption").ToString)
                LabelColor.LabelID = New Guid(row("Id").ToString)
                labelColor.Color = CInt(row("color"))
                labelColor.CaptionName = row("MenuCaption").ToString
                listOfLabel.Add(CInt(row("Idint")), labelColor)
            Next
        End If
    End Sub
End Class
